﻿<!DOCTYPE HTML>
<html>
{include file="public:header_css"}
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 门店管理 <span class="c-gray en">&gt;</span> 门店列表
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            <a class="btn btn-primary radius" href="{:url('add')}">
				<i class="Hui-iconfont">&#xe600;</i> 新增
			</a>
		</span>
        <span class="r">共有：<strong>{:count($list)}</strong> 条</span>
	</div>

    <div class="mt-20">
		<table class="table table-border table-bordered table-hover table-bg table-sort">
			<thead>
				<tr class="text-c">
					<th width="25"><input type="checkbox" name="" value=""></th>
					<th>开始时分</th>
					<th>结束时分</th>
					<th width="90">操作</th>
				</tr>
			</thead>
			<tbody>
				{foreach name="list" item="val" key="key"}
					<tr class="text-c">
						<td><input type="checkbox" value="{$val.id}" name=""></td>
						<td>{$val.start_hour}:{$val.start_minute}</td>
						<td>{$val.end_hour}:{$val.end_minute}</td>

						{if $val.is_show == 1}
							<td class="td-status"><span class="label label-success radius" onclick="deal('{$val.id}',0)">点击隐藏</span></td>
						{else}
							<td class="td-status"><span class="label label-danger radius" onclick="deal('{$val.id}',1)">点击显示</span></td>
						{/if}
					</tr>
				{/foreach}
			</tbody>
		</table>
	</div>

</div>

{include file="public:footer_js"}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/laypage/1.2/laypage.js"></script>

<script type="text/javascript">
    $(function(){
        $('.table-sort').dataTable({
            "aaSorting": [[ 1, "asc" ]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {"orderable":false,"aTargets":[0,2]}// 制定列不参与排序
            ]
        });

    });

    // 是否展示
	function deal(id,is_show) {
	    var notice = '确定隐藏吗？';
		if(is_show === 0){
		    notice = "确定隐藏吗？";
		}else if(is_show === 1){
		    notice = "确定显示吗？";
		}

        layer.confirm(notice,function(index){
            $.post(
                "{:url('deal')}",
                {
                    id:id,
                    is_show:is_show
                },
                function (res) {
                    if(res.code == 1){
                        // 弹出信息
                        layer.msg(res.msg,{icon:6,time:2000});

                        // 页面刷新
                        setTimeout(
                            // 跳转至管理后台首页
                            function(){
                                location.replace(location.href);
                            },
                            3000
                        );

                    }else{
                        // 弹出信息
                        layer.msg(res.msg,{icon:5,time:2000});
                    }
                }
            );
        });

    }

</script>
</body>
</html>